package com.hnas.activity.util;

import java.util.List;

import com.hnas.activity.domain.ActivityType;
import com.hnas.activity.orm.ActivityItem;

public class ActivityUtil {

	/**
	 * 获取常规打折redis的唯一key
	 * @param activityId
	 * @param mrchId
	 * @param termNo
	 * @return
	 */
	public static String getCgdzActivityKey(String activityId){
		return "cgdz_"+activityId;
	}
	/**
	 * 获取满减活动redis的唯一key
	 * @param activityId
	 * @return
	 */
	public static String getMjActivityKey(String activityId){
		return "mj1_"+activityId;
	}

	/**
	 * 是否包含随机减活动
	 * @param activityItems
	 * @return
	 */
	public static boolean hasRandomDerateActivity(List<ActivityItem> activityItems) {
		if(activityItems == null || activityItems.size() <= 0) return false;
		for(ActivityItem activityItem : activityItems){
			if(ActivityType.SJJ.getType().equals(activityItem.getSubType())){
				return true;
			}
		}
		return false;
	}
}
